Interrupt 21h Function 7160h Minor Code 1h 

Retrieves the complete path in its short form (the standard 8.3 format) for the specified file or path. The function returns the 8.3 filename for all directories in the path.

mov ax, 7160h

mov cl, 1                  ; Get Short Path Name

mov ch, SubstExpand        ; see below

mov si, seg SourcePath     ; see below

mov ds, si

mov si, offset SourcePath

mov di, seg DestPath       ; see below

mov es, di

mov di, offset DestPath

int 21h

jc  error

 

Parameters

SubstExpand

Flag that indicates if the returned path should contain a SUBST drive letter or the path associated with the SUBST drive. Zero is specified to indicate that the returned path should contain the path associated with the SUBST drive, and 80h is specified to indicate that the returned path should contain the SUBST drive letter.

SourcePath

Address of a null-terminated string that names the file or path to retrieve the complete short path for. Either the long or short form is acceptable as the source string.

DestPath

Address of the buffer that receives the complete path. The buffer should be large enough to contain the largest possible Windows 95 path in the short form (260 characters, including the drive letter, colon, leading backslash, and terminating null character).

 

Return Value

Clears the carry flag, modifies the AX register, and returns the complete short path in the given buffer if successful. Otherwise, the function sets the carry flag and sets the AX register to an error value.

Remarks

Relative paths containing the characters  .  and  ..  in SourcePath are fully expanded. Since this function performs validation, SourcePath must contain either a valid filename or path.